package org.example;

/**
 * 作者:TC
 * 时间:2023/11/30 10:30
 * 描述:没有bug
 */
import java.lang.Math;
public class Triangle {
    private int a;
    private int b;
    private int c;
    private boolean canTri;
    public boolean isTri(int a,int b,int c) {
        boolean canTri;
        int max = (a > b ? a : b) > c ? (a > b ? a : b) : c;
//        System.out.println(max);
        int min = (a < b ? a : b) < c ? (a < b ? a : b) : c;
//        System.out.println(min);
        if (max == a && b + c > a || max == b && a + c > b || max == c && a + b > c || min == a && Math.abs(b - c) < a || min == b && Math.abs(a - c) < b || min == c && Math.abs(a - b) > c) {
            canTri = true;
        } else {
            canTri = false;
    }
        return canTri;
}
//求周长的方法
    public void C(int a,int b,int c)
    {
        int C= a+b+c;
        System.out.println("三角形的周长为："+C);
    }
//    求三角形面积的方法
public void S(int a,int b,int c)
{
    double p=(a+b+c)/2;
    double S=Math.sqrt(p*(p-a)*(p-b)*(p-c));
    System.out.println("三角形的面积为："+S);
}
//    构造方法
    public Triangle(int a, int b, int c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }
//getter和setter方法
    public int getA() {
        return a;
    }

    public void setA(int a) {
        this.a = a;
    }

    public int getB() {
        return b;
    }

    public void setB(int b) {
        this.b = b;
    }

    public int getC() {
        return c;
    }

    public void setC(int c) {
        this.c = c;
    }
}
